home *** CD-ROM | disk | FTP | other *** search
- UI.PageCutScenePlayer=
- {
- GUI=
- {
- CutScene =
- {
- classname = "videopanel",
-
- left = 0, top = 0,
- width = 800, height = 600,
-
- color = "0 0 0 255",
-
- zorder = 1000,
-
- bordersize = 0,
- tabstop = 1,
-
- looping = 0,
- keepaspect = 1,
-
- OnError = function(Sender, szErrorString)
- UI.PageCutScenePlayer:Finished();
- end,
-
- OnFinished = function(Sender)
- UI.PageCutScenePlayer:Finished();
- end
- },
-
- OnUpdate = function(Sender)
-
- local bPlaying = UI.PageCutScenePlayer.GUI.CutScene:IsPlaying();
-
- if ((not bPlaying) or (tonumber(bPlaying) == 0)) then
- UI:StopCutScene();
-
- return;
- end
-
- if (UI.PageCutScenePlayer.bCanSkip and tonumber(UI.PageCutScenePlayer.bCanSkip) ~= 0) then
- local szKeyName = Input:GetXKeyPressedName();
-
- if ((szKeyName == "esc") or (szKeyName == "spacebar") or (szKeyName == "rmb") or (szKeyName == "lmb")) then
- UI:StopCutScene();
- end
- end
- end,
-
- OnActivate= function(Sender)
- if (UI.PageCutScenePlayer.szCutSceneName) then
- local szCutSceneName = UI.PageCutScenePlayer.szCutSceneName;
-
- UI:HideMouseCursor();
-
- UI.PageCutScenePlayer.GUI.CutScene:LoadVideo(szCutSceneName, 1);
- UI.PageCutScenePlayer.GUI.CutScene:Play();
- end
-
- UI.PageCutScenePlayer.szCutSceneName = nil;
- end,
-
- OnDeactivate = function(Sender)
- UI:ShowMouseCursor();
-
- local bPlaying = UI.PageCutScenePlayer.GUI.CutScene:IsPlaying();
-
- UI.PageCutScenePlayer.GUI.CutScene:ReleaseVideo();
-
- if (bPlaying) then
- UI.PageCutScenePlayer:Finished();
- end
-
- if (UI.PageCutScenePlayer.szGotoPage) then
- GotoPage(UI.PageCutScenePlayer.szGotoPage, UI.PageCutScenePlayer.bGotoPageShowBack);
- end
- UI:SetFocus(Sender.CutScene);
- end
- },
- };
-
- function UI.PageCutScenePlayer:Finished()
-
- Game:HideMenu();
-
- UI.bInGameOverride = nil;
- UI:DeactivateScreen("CutScenePlayer");
-
- if (UI.PageCutScenePlayer.szMessage and strlen(UI.PageCutScenePlayer.szMessage)) then
- Game:SendMessage(UI.PageCutScenePlayer.szMessage);
- elseif (UI.PageCutScenePlayer.pfnFunction) then
- UI.PageCutScenePlayer.pfnFunction();
- end
- end
-
- UI:CreateScreenFromTable("CutScenePlayer", UI.PageCutScenePlayer.GUI);
-
- function UI:PlayCutScene(szCutSceneName, szMessage, szGotoPage, bGotoPageShowBack)
- UI:PlayCutSceneEx(szCutSceneName, szMessage, szGotoPage, bGotoPageShowBack, 1);
- end
-
- function UI:PlayCutSceneEx(szCutSceneName, szMessage, szGotoPage, bGotoPageShowBack, bCanSkip)
-
- if (UI.MusicId ~= nil) then
- Sound:StopSound(UI.MusicId);
- end
-
- UI.bInGameOverride = 1; -- don't use the current ingame menu
-
- Game:ShowMenu();
-
- UI.PageCutScenePlayer.szCutSceneName = szCutSceneName;
- UI.PageCutScenePlayer.szGotoPage = szGotoPage;
- UI.PageCutScenePlayer.bGotoPageShowBack = bGotoPageShowBack;
- UI.PageCutScenePlayer.bCanSkip = bCanSkip;
-
- if (type(szMessage) == "function") then
- UI.PageCutScenePlayer.pfnFunction = szMessage;
- UI.PageCutScenePlayer.szMessage = nil;
- else
- UI.PageCutScenePlayer.szMessage = szMessage;
- UI.PageCutScenePlayer.pfnFunction = nil;
- end
-
- UI:DeactivateAllScreens();
- UI:ActivateScreen("CutScenePlayer");
- end
-
- function UI:StopCutScene()
- UI:DeactivateScreen("CutScenePlayer");
- end